<section class="Hui-article-box">
	<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
		<span class="c-gray en">&gt;</span>
		用户管理
		<span class="c-gray en">&gt;</span>
		用户添加 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
			href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
	</nav>
	<article class="cl pd-20">
		<form action="{:U('admin/user/add')}" method="post" class="form form-horizontal" id="form-admin-add">
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户：</label>
				<div class="formControls col-xs-6 col-sm-7">
					<input type="text" class="input-text" value="" placeholder="" name="user_name">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">初始密码：</label>
				<div class="formControls col-xs-6 col-sm-7">
					<input type="password" class="input-text" autocomplete="off" value="" placeholder="不填默认为123456" name="password">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>手机：</label>
				<div class="formControls col-xs-6 col-sm-7">
					<input type="text" class="input-text" value="" placeholder="" name="mobile">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>邮箱：</label>
				<div class="formControls col-xs-6 col-sm-7">
					<input type="text" class="input-text" placeholder="@" name="email">
				</div>
			</div>
			<div id="roles" class="row cl">
				<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>角色：</label>
				<div class="formControls col-xs-6 col-sm-7">
					<dl class="permission-list">
						<dd>
							<volist name="list" id="item1" key="key1">
								<label style="padding-right: 10px">
									<input type="checkbox" value="{$item1['id']}"
										name="role_ids[]">{$item1['role_name']}
								</label>
							</volist>
						</dd>
					</dl>
				</div>
			</div>
			<div class="row cl">
				<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
					<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
				</div>
			</div>
		</form>
	</article>
</section>
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__PUBLIC__/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="__PUBLIC__/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="__PUBLIC__/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript">
	$(function () {
		$('.skin-minimal input').iCheck({
			checkboxClass: 'icheckbox-blue',
			radioClass: 'iradio-blue',
			increaseArea: '20%'
		});

		$("#form-admin-add").validate({
			rules: {
				role_name: {
					required: true,
					minlength: 2,
					maxlength: 16
				},
				mobile: {
					required: true,
					isPhone: true,
				},
				email: {
					required: true,
					email: true,
				},
				"role_ids[]": {
					required: true,
        			minlength: 1
				},
			},
			messages: {
				role_ids:{
					required: "必选",
					minlength:"最少选择1个角色"
				}
			},
			onkeyup: false,
			focusCleanup: true,
			success: "valid",
			submitHandler: function (form) {
				form.submit();
			}
		});
	});
</script>